import "reflect-metadata";
import { DataSource, DataSourceOptions } from "typeorm";
import { Attachment, Board, Comment, Post, User, Tag } from "./entities";
import { config } from "dotenv";

config();

export const AppDataSource = new DataSource({
  type: process.env.DB,
  host: process.env.DB_HOST,
  port: process.env.DB_PORT,
  username: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_NAME,
  synchronize: true,
  logging: false,
  entities: [User, Board, Post, Comment, Attachment, Tag],
  migrations: [],
  subscribers: [],
} as DataSourceOptions);
